//////////////////////////////////////////////////////////////////////////////////////////////////////////// // // //-------------------------------- Ebrahim Foulaadvand, 13 Nov 2012 --------------------------------------// // // // The routine "NeutronDiffusion" solves the Neutron diffusion equation using forward time centered // // space scheme. Dirichlet boundary condition is used. // // // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include using namespace std; main() { double D=1.,C=1.,L=3.5,tau,h,nL=0.,nR=0.;// D=diffusion constant, C=neutron creation rate, L=system length. //tau=timestep,h=spatial grid. int N=60,i,n,Time=20000; //N=number of spatial grids, Time=number of time steps, n=timstep number. vector ncur(N+1,0),nnew(N+1,0),nAv(Time+1,0); ofstream file1 ("n n=10.plt"); //output file for temperature profile at timestep n=10. ofstream file2 ("n n=100.plt"); //output file for temperature profile at timestep n=100. ofstream file3 ("n n=10000.plt"); //output file for temperature profile at timestep n=1000. ofstream file4 ("n n=15000.plt"); //output file for temperature profile at timestep n=15000. ofstream file5 ("nAv.plt"); //output file for the average neutron density. h=L/N; cout<<"h= "<